<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>防火墙列表</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function viewDetail(id){
			console.info(id);
			$.ajax({
				type: "POST",
				url: "${ctx}/scene/sceneRouter/findFireRuleList",
				data: {
					ids:id
				},
				<%--data: {id:${"#id"}.val()},--%>
				success: function (fireRuleList) {
					for (var i = 0; i < fireRuleList.length; i++) {
						$("#algorithm").append("<li>" + fireRuleList[i].cidr+'('+fireRuleList[i].subnetName+')' + "</li>");

					}


				},
				error:function(){
					alert("error");
				}
			});
			$.jBox($("#viewDetailBox").html(), {title:"查看接口", buttons:{"关闭":true}, submit: function(){}});

		}
	</script>
	<script type="text/template" id="viewDetailBox">
		<div>
			<ul id="algorithm">
			</ul>
		</div>
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/scene/sceneRouter/firewallList?environmentId=${environmentId}&type=${type}">防火墙</a></li>
		<%--<li><a href="${ctx}/scene/sceneRouter/form">防火墙策略</a></li>--%>
		<%--<li><a href="${ctx}/scene/sceneRouter/form">防火墙规则</a></li>--%>

	</ul>
	<input type="hidden" id="type" name="type" value="${type}">
	<input type="hidden" id="environmentId" name="environmentId" value="${environmentId}"/>
	<%--<input class="btn btn-primary" type="button" value="添加防火墙" onclick="window.location.href='${ctx}/scene/sceneRouter/firewallForm?routerId=${routerId}&environmentId=${environmentId}'"/>--%>
	<%--<br><br>--%>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>防火墙</th>
				<th>防火墙规则</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${firewallList}" var="sceneFirewall">
			<tr>
				<td>
					${sceneFirewall.firewallName}
				</td>
				<td>
					<a href="${ctx}/scene/sceneRouter/firewallRuleList?environmentId=${environmentId}&firewallId=${sceneFirewall.id}&type=${type}">查看</a>
				</td>

				<td>
					<a href="${ctx}/scene/sceneRouter/firewallRuleForm?environmentId=${environmentId}&firewallId=${sceneFirewall.id}&type=${type}">添加防火墙规则</a>

					<%--<a href="${ctx}/scene/sceneRouter/firewallForm?routerId=${routerId}&firewallId=${sceneFirewall.id}">修改</a>--%>
				</td>

			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div style = "text-align:right;">
		<input id="btnSubmit" style="margin-right: 100px;margin-top: 20px" class="btn btn-primary" type="button" value="保存" <c:choose>
			<c:when test="${type=='ctf'}">
				onclick="window.location.href='${ctx}/scene/sceneCtfEnvironment/'"
			</c:when>
			<c:otherwise>
				onclick="window.location.href='${ctx}/scene/sceneEnvironment/'"
			</c:otherwise>
		</c:choose> />
	</div>
</body>
</html>